<template>
  <div>
    <!-- 面包屑 -->
    <!-- <div class="breadcrumb">
      <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
        <img class="icon" src="@/assets/authentication/组6-6.png" alt="" />
        <el-breadcrumb-item>
          <span class="span">用户中心</span>
        </el-breadcrumb-item>
        <el-breadcrumb-item>
          <span class="span" style="color: #666">认证信息</span>
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div> -->
    <!-- 认证信息主体 -->
    <div class="box">
      <div class="title">
        <h3>
          <span>平台认证</span>
        </h3>
      </div>
      <!-- <div class="box-center"> -->
      <!-- 进度条 -->
      <div class="f1">
        <ul>
          <li>
            <div class="icon">
              <img class="icon1" src="@/assets/kuajing/组172.png" alt="" />
              <img class="icon2" src="@/assets/kuajing/组175.png" alt="" />
            </div>
            <span>经办人认证</span>
          </li>
          <li>
            <div class="icon">
              <img class="icon1" src="@/assets/kuajing/组174.png" alt="" />
              <img class="icon2" src="@/assets/kuajing/组175.png" alt="" />
            </div>
            <span style="margin-left: -0.2083rem">组织信息核验</span>
          </li>
          <li>
            <div class="icon">
              <img class="icon1" src="@/assets/kuajing/组178.png" alt="" />
              <img class="icon2" src="@/assets/kuajing/组175.png" alt="" />
            </div>
            <span style="margin-left: -0.0833rem">意愿认证</span>
          </li>
          <li>
            <div class="icon">
              <img class="icon1" src="@/assets/kuajing/组179.png" alt="" />
            </div>
            <span style="margin-left: 0px; color: #999">完成</span>
          </li>
        </ul>
      </div>
      <div class="f3">
        <div class="f3-top">
          <img src="@/assets/kuajing/组191.png" alt="" />
          <p>打款已受理！预计两小时内到账</p>
          <!-- <p></p> -->
        </div>
        <div class="f3-bottom">
          <p>您收到的打款金额<input v-model="amount" />元</p>
        </div>
        <!-- 服务协议 -->
        <div class="agreement">
          <img
            @click="submitBtn"
            :src="require(`@/assets/shangpiao/组${radio ? '38' : '39'}.png`)"
            alt=""
          />
          <span> 阅读并同意 </span>
          <a
            href="http://operate.thunlink.cn/protocol/4 企业授权协议-商驿/4 企业授权协议-商驿.html"
            target="_back"
            >《电子签名授权协议》</a
          >
        </div>
        <!-- 上一步/保存/提交 按钮 -->
        <div class="submit">
          <button :disabled="isLock" class="btn" @click="addentQYDKJE()">提交</button>
          <p @click="go_1">重新认证</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { addentQYDKJE } from '@/utils'
export default {
  data() {
    return {
      isLock: false,
      radio: false, //企业授权服务状态变量
      row: 1,
      flowId: '',
      amount: ''
    }
  },
  mounted() {
    this.flowId = this.$route.query.flowId
  },
  // 方法
  methods: {
    // 勾选协议
    submitBtn() {
      this.radio = !this.radio
    },
    async addentQYDKJE() {
      if (!this.radio) return this.$Message.error('请勾选协议')
      this.isLock = true
      setTimeout(() => {
        this.isLock = false
      }, 3000)
      if (this.amount.trim() == '') return this.$Message.error('请输入金额')
      let parameter = {
        amount: this.amount,
        flowId: this.flowId
      }
      let data = await addentQYDKJE(parameter)
      if (data.code == 100) {
        let rzstatus = data.data.rzstatus
        let token = data.data.token
        localStorage.removeItem('succ')
        sessionStorage.setItem('rzstatus', rzstatus)
        sessionStorage.setItem('token', token)
        this.$router.push('/authentication4')
        this.$Message.success('认证成功')
        return
      } else if (data.code == 30502003) {
        this.$Message.error('认证失败')
        this.$router.push('/authentication2')
      } else if (data.code == 30500002) {
        this.$Message.error('认证失败')
        this.$router.push('/authentication2')
      } else if (data.code == 30502002) {
        this.$Message.error('金额输入有误，请重新输入')
      }
    },
    // 返回上一步
    go_1() {
      this.$router.push('/authentication2')
    }
  }
}
</script>

<style lang="scss" scoped>
// 面包屑
.breadcrumb {
  display: flex;
  align-items: center;
  height: 0.3958rem;
  font-size: 0.0833rem;
  background-color: rgb(242, 244, 247);
  .icon {
    margin: 0 0.0521rem 0 0.0208rem;
  }
  .span {
    font-size: 0.0833rem;
    font-family: Source Han Sans SC;
    font-weight: 400;
    color: #999999;
  }
  img {
    width: 0.0938rem;
    height: 0.0938rem;
    margin-right: 0.026rem;
  }
}
// 主体
.box {
  box-sizing: border-box;
  width: 100%;
  border-radius: 0.0313rem;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.2604rem;
  // 标题
  .title {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 0.1302rem;
    h3 {
      font-size: 0.1146rem;
      font-family: Source Han Sans SC;
      font-weight: bold;
      color: #222222;
    }
  }
  .f1 {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-top: 0.1042rem;
    ul {
      display: flex;
      align-items: center;
      li {
        display: flex;
        flex-direction: column;
        height: 0.2083rem;
        .icon {
          .icon1 {
            width: 0.1875rem;
          }
          .icon2 {
            width: 0.9375rem;
            height: 0.0104rem;
            margin: 0 0.1042rem;
          }
        }
        span {
          font-size: 0.1042rem;
          font-family: Source Han Sans SC;
          font-weight: 400;
          color: #627dca;
          margin-left: -0.1563rem;
          margin-top: 0.0156rem;
        }
      }
    }
  }
  .f2 {
    display: flex;
    height: 0.1354rem;
    margin-top: 0.2865rem;
    margin-left: 0.5208rem;
    p {
      font-size: 0.0833rem;
      color: #787c80;
    }
    .option {
      display: flex;
      // justify-content: space-between;
      margin-left: 0.0781rem;
      width: 3.125rem;
      height: 0.1354rem;
      // background-color: #f00;
      .option-d1 {
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        border: 1px solid #b3b3b3;
        background-color: #fff;
        color: #808080;
        width: 0.9896rem;
        height: 0.1354rem;
        font-size: 0.0833rem;
        &.active {
          cursor: pointer;
          display: flex;
          align-items: center;
          justify-content: center;
          width: 0.9896rem;
          height: 0.1354rem;
          background: #84c8db;
          border: 1px solid #84c8db;
          font-size: 0.0833rem;
          font-family: Source Han Sans SC;
          font-weight: 400;
          color: #fff;
        }
      }
    }
  }
  .f3 {
    display: flex;
    // justify-content: center;
    flex-direction: column;
    align-items: center;
    width: 100%;
    // height: 800px;
    // background-color: #f00;
    .f3-top {
      display: flex;
      flex-direction: column;
      align-items: center;
      img {
        width: 2.3958rem;
        height: 1.6563rem;
        margin-top: 0.2083rem;
      }
      p {
        font-size: 0.0833rem;
        font-family: Source Han Sans SC;
        font-weight: 400;
        color: #b3b3b3;
        margin-bottom: 0.0781rem;
      }
    }
    // 服务协议
    .agreement {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 0.1302rem;
      text-align: center;
      margin-top: 0.3646rem;
      user-select: none;
      span {
        font-size: 0.0729rem;
        color: #666;
        margin-left: 0.0365rem;
      }
      img {
        width: 0.0781rem;
        height: 0.0781rem;
        cursor: pointer;
      }
      a {
        font-size: 0.0729rem;
        color: #3f6ef2;
      }
    }
    .f3-bottom {
      margin-top: 0.1823rem;
      p {
        font-size: 0.0833rem;
        font-family: Source Han Sans SC;
        font-weight: 400;
        color: #262626;
      }
      input {
        padding: 0.026rem 0.0521rem;
        width: 0.2604rem;
        border-bottom: 0.0052rem solid #666666;
        text-align: center;
      }
    }
  }
  // 按钮组
  .submit {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 0.2604rem;
    margin: 0.026rem 0 0.026rem 0;
    cursor: pointer;
    margin-top: 0.1563rem;
    .btn {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 0.9375rem;
      height: 0.1771rem;
      background: linear-gradient(-90deg, #5d98f8, #4b5af8);
      border-radius: 0.0208rem;
      font-size: 0.0938rem;
      font-family: Source Han Sans SC;
      font-weight: 400;
      color: #ffffff;
      margin-right: 0.1563rem;
    }
    p {
      font-size: 0.0833rem;
      color: #3f6ef2;
      text-decoration: underline;
    }
  }
}

/* 输入框样式  */
::v-deep .el-input__inner {
  box-sizing: border-box;
  width: 370px;
  height: 39px;
  font-size: 14px;
  border: 1px solid #e0e0e0;
  border-radius: 0px;
  padding: 10px 10px;
  color: #606266;
  outline: 0;
}
</style>
